import axios from '@/libs/axios1'
let jsonHeaders = {'content-type': 'application/json;charset=UTF-8'}
let url = '/topo-control'
//虚拟机操作,开机,关机等
export const opVms = (vmId,action) =>{
  return axios({
    url: `${url}/servers/${vmId}/action/${action}`,
    method: 'post',
    headers: jsonHeaders
  })
}

//重置虚拟机
export const rebuildVm = (vmId) =>{
  return axios({
    url: `${url}/servers/${vmId}/action/rebuild`,
    method: 'post',
    headers: jsonHeaders
  })
}

//重启虚拟机
export const rebootVm = (vmId,type) =>{
  return axios({
    url: `${url}/servers/${vmId}/action/${type}`,
    method: 'post',
    headers: jsonHeaders
  })
}


//获取虚拟机状态
export const queryVmStatus = params =>{
    return axios({
        url: `${url}/servers/batch_status`,
        method: 'post',
        data: params,
        headers: jsonHeaders
    })
}